package cn.ecpark.service.kafka.service;

import cn.ecpark.service.kafka.util.Topic;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class KafkaConsumer {


    @KafkaListener(topics = {Topic.NAME})
    public void doConsumer(ConsumerRecord<?,?> record) {

        log.info("消费的主题：{}，分区：{}，内容：{}, 偏移量:{}",
                record.topic(),record.partition(),record.value(),record.offset());
    }


}
